#!/bin/bash

set -x
NET_ARGS=()                 # 存最终所有 -device / -netdev 参数

BASE_MAC=50:00:00:03:00   # 基础 MAC

for (( idx=0; idx<4;idx++)) ;do

    mac=$(printf "$BASE_MAC:%02d" $idx)
    
    tap="tape_${idx}"	

    # 2. 生成 QEMU 参数
    NET_ARGS+=(
      -device e1000,netdev="net$idx",mac="$mac"
      -netdev tap,id="net$idx",ifname="$tap",script=no,downscript=no
    )

done    




 /opt/qemu-2.12.0/bin/qemu-system-x86_64 -nographic ${NET_ARGS[@]} -smp 2 -m 4096 -name S9850 -uuid 3036739f-8bfd-4660-ab2c-563fb91e3d45 -hda /opt/unetlab/addons/qemu/h3cvswitch_S9850-7.1.070-R7643P02/hda.qcow2 \
	 -machine type=pc,accel=kvm -vga std -serial mon:stdio \
	 -nographic -no-user-config -nodefaults -rtc base=utc -cpu host,vmx=off,svm=off
